#include <iostream>
using namespace std;

class Cuboid{
    private:
        double length;
        double weight;
        double hight;
    public:
        // 初始化的函数
        void init(double l, double w, double h);
        // 获取体积的函数
        double get_volume();
        // 获取长度的函数
        double get_length();
        // 获取宽度的函数
        double get_weight();
        // 获取高度的函数
        double get_hight();
        // 成员函数：判断两个长方体是否相等
        bool my_judge(Cuboid &x, Cuboid &y);
        // 成员函数改进版：判断两个长方体是否相等
        bool my_judge(Cuboid &other);
};

void Cuboid::init(double l, double w, double h){
    length = l;
    weight = w;
    hight = h;
}

double Cuboid::get_volume(){
    return length * weight * hight;
}

double Cuboid::get_length(){
    return length;
}

double Cuboid::get_weight(){
    return weight;
}

double Cuboid::get_hight(){
    return hight;
}

bool Cuboid::my_judge(Cuboid &x, Cuboid &y){
    if(x.hight == y.hight && \
        x.length == y.length &&\
        x.weight == y.weight){
        return true;
    }else{
        return false;
    }
}

bool Cuboid::my_judge(Cuboid &other){
    if(hight == other.hight && \
        length == other.length &&\
        weight == other.weight){
        return true;
    }else{
        return false;
    }
}

// 全局函数：判断两个长方体是否相等
// 理论上应该给形参加 const 更好 但这样涉及到常对象的使用 --后面再讲
// bool my_judge(const Cuboid &x, const Cuboid &y){
bool my_judge(Cuboid &x, Cuboid &y){
    if(x.get_hight() == y.get_hight() && \
        x.get_length() == y.get_length() &&\
        x.get_weight() == y.get_weight()){
        return true;
    }else{
        return false;
    }
}

int main(int argc, const char *argv[]){
    Cuboid c1;
    c1.init(3, 4, 5);
    Cuboid c2;
    c2.init(3, 4, 5);
    Cuboid c3;
    c3.init(3, 3, 4);

    cout << boolalpha;
    cout << my_judge(c1, c2) << endl; // true
    cout << my_judge(c1, c3) << endl; // false

    cout << "-----------------------" << endl;
    cout << c1.my_judge(c1, c2) << endl;
    cout << c1.my_judge(c1, c3) << endl;

    cout << "-----------------------" << endl;
    cout << c1.my_judge(c2) << endl;
    cout << c1.my_judge(c3) << endl;

    return 0;
}